<?php
$this->Html->addCrumb('Documents', '/member/documents');
$this->Html->addCrumb('Add');
?>
<?php 
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#DocumentMemberAddForm").TWS_Form( {
          validate : {
          rules : {
            DocumentTitle : {required : true, help : "This is the title for the document"},
            DocumentFilePath: {required : true, help : "Select the document to be uploaded"},
            DocumentVisibility : {help : "Private : Only club members will be able to see this document<br/><br/>Public : This document will be available for download from the main website."}
          }
          }});
        });
       ';
$this->Html->scriptEnd();
?>
<h1>Add Document</h1>

<?php echo '<div id="actionLink">'.$this->Html->link('Back to list of Documents',array('action'=>'index', 'member'=>true)).'</div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('Document',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));

echo $this->TWSForm->input('title', array('name'=>'DocumentTitle', 'type'=>'text', 'size'=>'65', 'label'=>'<span class="required">*</span>Title'));
echo $this->TWSForm->input('file_path', array('type'=>'file', 'label'=>'<span class="required">*</span>Upload document', 'name'=>'DocumentFilePath'));
echo $this->TWSForm->input('visibility', array('type'=>'select','options'=>$visibilityOptions,'name'=>'DocumentVisibility'));
echo $this->TWSForm->end( array("label"=>"Add", "class"=>"button"));


?>